From 9cca9d355b250f0a7b6242fd26b361aaeeea79fc Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Wed, 27 Oct 2004 21:25:17 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.293 (4180123d6fy9CmhZFhA2dxg-C2tnig) create.py: Set the name of the vm to the config file's basename if no name is specified in the config file or on the commandline. opts.py: Handle trailing getopt arguments correctly. --- tools/python/xen/xm/create.py | 2 ++ tools/python/xen/xm/opts.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tools/python/xen/xm/create.py b/tools/python/xen/xm/create.py index 1c0fa6cb4f..9d977dd337 100644 --- a/tools/python/xen/xm/create.py +++ b/tools/python/xen/xm/create.py @@ -465,6 +465,8 @@ def main(argv): else: opts.load_defconfig() preprocess(opts, opts.vals) + if not opts.getopt('name') and opts.getopt('defconfig'): + opts.setopt('name', os.path.basename(opts.getopt('defconfig'))) config = make_config(opts.vals) if opts.vals.dryrun: PrettyPrint.prettyprint(config) diff --git a/tools/python/xen/xm/opts.py b/tools/python/xen/xm/opts.py index 0dfee0b7c9..f92c82dfe6 100644 --- a/tools/python/xen/xm/opts.py +++ b/tools/python/xen/xm/opts.py @@ -313,6 +313,9 @@ class Opts: print >>sys.stderr, "Error: Unknown option:", k self.usage() + if not args: + break + # then process the 1st arg (arg,args) = (args[0], args[1:]) -- 2.30.2